/**
 * 拍摄信息页面
 * - 使用自定义封装组件，简化代码，统一管理。
 * - 2025-07-17 09:36:43 tzj
 * */

import BaseComponent from "../../components/BaseComponent";
import {psApi} from "../../services/basic";
import AddOrEdit from "./addOrEdit";
import Dictionary from "../../services/dictionary";
// import EditItem from "./EditItem";

// 要显示的form表单
const formItemList =

    [
        "platform",
        {
            name: "text",
            label: "拍摄项目",
            keyword: "psxm"
        },
        {
            name: "accounts",
            label: "发布账号",
            // keyword:"sfzh"
        },
        // {
        //     name: "person",
        //     label: "剪辑人员",
        //     keyword: "jjry"
        // },
        {
            name: "person",
            label: "拍摄/剪辑",
            keyword: "psry"
        },
        {
            name: "person",
            label: "演员",
            keyword: "yy"
        },
        "shootStates",
        {
            name:"dateRange",
            label:'拍摄日期'
        }];
// 显示的按钮
const buttons = ["query", "add", "edit", "export"];
// 表格列信息
const columns = [
    {
        title: '发布平台', dataIndex: 'fbpt', render(text) {
            const indexes = text ? text.split(",") : [0];
            const selectedItems = indexes.map(index => Dictionary.platform[index]);
            return selectedItems.join(",");
        }
    },
    {title: '拍摄项目', dataIndex: 'psxm'},
    {title: '发布账号', dataIndex: 'fbzhmc'},
    {title: '发布日期', dataIndex: 'fbrq'},
    {title: '车型', dataIndex: 'cx'},
    // {title: '剪辑人员', dataIndex: 'jjryxm'},
    {title: '拍摄/剪辑', dataIndex: 'psryxm'},
    {title: '演员', dataIndex: 'yyxm'},
    {
        // 改成tag？
        title: '状态', dataIndex: 'zt', render(text) {
            return Dictionary.shootStates[Number(text)];
        }
    },
];

class pageLive extends BaseComponent {
    constructor(props) {
        super(props);
        this.state = {
            ...this.state,
            formItemList,
            buttons,
            // columns,
            filename: "拍摄统计",
            // tableTitle: true,
            params: {
                // ztbz: "1"
            },
            // rowKey: "lzid",
            // dataBook
        }
        this.defaultPageSize = 7;
        this.columns = columns;
        this.queryApi = psApi.getPage;
        // this.deleteApi = psApi.deletePs;
        this.EditItem = AddOrEdit;
    }

    // componentDidMount() {
    //     super.componentDidMount();
    // }
}

export default pageLive;